Using file system information in RAID data reconstruction and migration

ABSTRACT

On disk failure, the storage system migrates only those disk blocks that included allocated data, and treats unallocated disk blocks as being logically zero when possible. When there is no spare disk, the source data block is logically set to zero and parity is recalculated for the RAID stripe associated with the source data block. When there is a spare, unallocated blocks on the spare are logically or physically set to zero upon migration. Write operations for the failed disk are redirected to other non-failing disks, and a record of which in-use disk blocks have been thus “migrated” to those other non-failing disks in maintained. Unused disk blocks are proactively set to zero. A target mirror copy is created using information regarding allocated disk blocks, by copying those blocks including allocated data or parity, and by clearing at the mirror those blocks not including any allocated data or parity.

BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] The invention relates to using file system information in RAID data reconstruction and migration.

[0003] 2. Related Art

[0004] One known method of maintaining mass storage in computer systems is called RAID (“Redundant Array of Inexpensive Disks”). RAID storage includes a group of disks, at least portions of which are used to store data and at least portions of which are used to store parity information associated with that data, in which the data and the parity are distributed across multiple disks. This allows a RAID storage system to reconstruct the original data (from the rest of the stored data and from the parity information) in the event that one of the disk blocks (which store data or parity) fails, or in the event that an entire disk fails. Data and parity are associated with each other in sets of disk blocks called RAID stripes.

[0005] One known problem with RAID storage is that, in the event a drive fails, the RAID storage system no longer has the same degree of redundancy, and must be adjusted if it is desired to maintain that same degree of redundancy. That is, it is desirable for the RAID storage system to allow a later second disk failure without loss of data, but it will not be possible to reconstruct data for two separate failed disks in a RAID stripe. To maintain the same degree of redundancy, the RAID storage system either has a spare disk onto which to reconstruct the data from the failed disk, or (if there is adequate available space) migrates data from the failed disk to other disks. In the latter case, parity associated with each RAID stripe must be adjusted in response to migration of allocated data. However, reconstruction of data and recalculation of parity involve substantial read and write operations with the disk drives, and it would be advantageous to minimize both the number of accesses to the disks and the amount of information transferred back and forth between the disks and the rest of the computer system.

[0006] Accordingly, it would be advantageous to provide a storage system (which might be a RAID storage system or another type of storage system) which maintains data reliability, allows for logical deletion of failed disks, and which minimizes the amount of computation and disk access to perform data migration or reconstruction, or parity adjustment. These advantages and others are provided in an embodiment of the invention, in which information maintained by the file system (including information regarding which disk blocks are actually in use recording stored data) is used in data reconstruction and migration, and recalculation of parity. Advantages of the invention in minimizing computation and disk access can also be used in normal operation of the storage system, as well as in mirroring entire storage volumes from a source to a target storage system.

SUMMARY OF THE INVENTION

[0007] The invention provides a method and system which maintains data reliability, allows for logical deletion of failed disks, and which minimizes the amount of computation and disk access to perform data migration or reconstruction, or recalculation of parity. In a preferred embodiment, the storage system uses information regarding essentially only allocated disk blocks when performing data reconstruction and migration, and recalculation of parity and ignores the unallocated disk blocks that have been set to a predetermined value, e.g., zero. On a disk failure, the storage system migrates only those disk blocks on the failed disk that included allocated data, and treats unallocated disk blocks as being logically zero when possible.

[0008] In an aspect of the invention, information maintained by a file system identifies which disk blocks are actually allocated on a failed disk. A disk in the RAID group might fail either when there is a spare disk or when there is no spare disk. When data blocks are to be migrated from the failed disk, but there is no spare disk, those data blocks are migrated from the failed disk to other non-failing disks in the RAID group, thus reducing the number of disks in the RAID group. When those data blocks are migrated (that is, the data is reconstructed and copied onto a target data block), the source data block is logically set to zero and parity is recalculated for the RAID stripe associated with the source data block. Once all allocated data blocks from the failed disk have been migrated, the failed disk can be logically removed from the RAID group. When data blocks are to be migrated from a failed disk to a spare disk, those data blocks are migrated in like manner, except that unallocated blocks on the spare disk are logically or physically set to a selected value (zero) upon migration.

[0009] In an aspect of the invention, the file system actively assists the RAID storage system by redirecting write operations (intended for disk blocks on the failed disk) to other non-failing disks. The file system also maintains a record of which in-use disk blocks have been thus “migrated” to those other non-failing disks, thus providing an indicator of when stored data originally maintained on the failed disk has been completely migrated. When writing to disk, the file system proactively sets unused disk blocks to a selected value (zero), to minimize the amount of parity recalculation, both at the time of writing as well as at later times for writing. In a preferred embodiment, the file system sets unused disk blocks to zero at least in the following cases: (1) when a new disk is added to a RAID group, (2) when a RAID stripe that includes unused disk blocks is written to. In a preferred embodiment, the file system maintains a “consistency point” at which stored data is assured self-consistent, and sets unused disk blocks to zero when writing a consistency point to disk.

[0010] In an aspect of the invention, the RAID storage system might use a technique (such as RAID level 5), in which parity blocks might be found on different disks. When one of those disks fails, the file system identifies those RAID stripes associated with parity information on the failed disk, and migrates the entire set of data blocks from those stripes to other disks, so as to maintain parity information for those entire stripes on non-failing disks.

[0011] In an aspect of the invention, the storage system uses information regarding allocated disk blocks to improve the operations performed by the RAID storage system. The storage system determines when writing any one RAID stripe and in response to which disk blocks are allocated, whether it is more efficient to compute parity by subtraction or by recalculation.

[0012] In an aspect of the invention, a target mirror copy of a storage volume can be created using file system information regarding allocated disk blocks, by copying (to the mirror copy) those blocks including allocated data and those blocks including parity, and by clearing (at the mirror copy) those blocks not including any allocated data or parity. The target storage volume can thus be constructed in response to the source storage volume, without requiring any parity recalculation.

[0013] The invention has general applicability to file systems and storage systems in which data is maintained on multiple devices, and in which at least some information recorded on those multiple devices can be discarded (for example, is not part of a file system or is a cached object that can be evicted from a cache). None of these applications are limited specifically to file systems that maintain consistency points, nor are they limited specifically to RAID storage systems, nor are they otherwise restricted to systems related to the specific applications disclosed herein.

BRIEF DESCRIPTION OF THE DRAWINGS

[0014]FIG. 1 shows a block diagram of a file system and a RAID storage system, including using file system information in RAID data reconstruction.

[0015]FIG. 2 shows a process flow diagram of a method including using file system information in RAID data reconstruction.

[0016]FIG. 3 shows a block diagram of a system capable of mirroring without recalculating parity.

[0017]FIG. 4 shows a process flow diagram of a method of mirroring without recalculating parity.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

[0018] In the description herein, a preferred embodiment of the invention is described, including preferred process steps and data structures. Those skilled in the art would realize, after perusal of this application, that embodiments of the invention might be implemented using a variety of other techniques not specifically described, without undue experimentation or further invention, and that such other techniques would be within the scope and spirit of the invention.

[0019] Lexicography

[0020] The following terms relate or refer to aspects of the invention or its embodiments. The general meaning of each of these terms is intended to be illustrative and in no way limiting.

[0021] consistency point—In general, this refers to an identifiable set of data maintained by a file system that is self-consistent and can therefore be preserved on disk without worry that reference to data within the consistency point will result in file system errors. The phrase “consistency point” is intended to be broad enough to cover file systems that have their self-consistency assured by a set of journal entries for recent changes, as well as those which are atomically self-consistent.

[0022] disk block—In general, this refers to an allocable portion of a mass storage system in which data can be stored. The phrase “disk block” is intended to be broad enough to cover allocable space on disks that are either quantized or not.

[0023] file system—In general, this refers to any application that manages disk blocks directly on a storage system, including a system that maintains an association between a naming schema and file data maintained on mass storage. The phrase “file system” is intended to be broad enough to cover variants of file systems, including both those systems that read and write directly to/from disk and those systems that allow a different subsystem or other part of an operating system to read or write to disk.

[0024] migration of disk blocks—In general, this refers to any technique for copying or reconstructing data from disk blocks that have been lost onto a different portion of a mass storage system, such as a disk that has not failed and is therefore usable.

[0025] parity recalculation—In general, this refers to any technique for recovering parity information or other redundant information after loss, in response to stored data, whether in combination with other redundant information or not.

[0026] RAID group—In general, this refers to the set of disks included in a RAID storage system, and used by the RAID storage system to maintain data redundancy. Some systems might include RAID storage systems that separate their disks into more than one RAID group.

[0027] RAID storage system—In general, this refers to any technique for maintaining data on a mass storage system that includes a set of redundancy information (such as possibly parity information, a Hamming code, or some other form of redundancy like a copy of the actual data), and that provides the possibility of reconstruction of data in response to loss.

[0028] RAID stripe—In general, this refers to any association between data blocks and redundancy information, in which data blocks and redundancy information are interdependent so that at least some can be recovered after loss.

[0029] reconstruction—In general, this refers to any technique for recovering data after loss, in response to redundancy information, whether in combination with other stored data or not.

[0030] zeromap—In general, this refers to a table having a set of entries indicating which disk blocks have been logically or physically set to zero.

[0031] stripemap—In general, this refers to a table having a set of entries indicating which RAID stripes have been migrated from a failed disk.

[0032] The scope and spirit of the invention is not limited to any of these definitions, or to specific examples mentioned therein, but is intended to include the most general concepts embodied by these and other terms.

[0033] System Elements

[0034]FIG. 1 shows a block diagram of a file system and a RAID storage system, including using file system information in RAID data reconstruction.

[0035] A system 100 includes a file system 120, a storage system 140, and a communication link 160 between the two.

[0036] The file system 120 includes a processor (not shown), program and data memory (not shown), and a set of file system information tables 121 indicating information about disk blocks (whether individually or in groups thereof) in the storage system 140. The file system information tables 121 can be recorded in the memory, or can be recorded on selected portions of the storage system 140, or otherwise (such as in a non-volatile memory or other auxiliary storage device), so long as those file system information tables 121 remain accessible to the file system 120 even in the event of data lost by the storage system 140. Particular information in the file system information tables 121 is further described below.

[0037] The storage system 140 includes a set of disks 141, each of which includes a set of disk blocks 142 including data (stored within at least some disk blocks 142), the disk blocks 142 being disposed in a set of RAID stripes 143 including at least some redundant information (stored within at least some disk blocks 142). The RAID stripes 143 are disposed so that information on any individual disk block 142 on any individual disk 141 is associated with information on other disk blocks 142 on other disks 141. This allows information on any individual disk block 142 to be reconstructed or recalculated in the event of loss of any disk block 142 or even an entire disk 141. RAID storage systems are known in the art of mass storage systems.

[0038] The communication link 160 couples the file system 120 and the storage system 140, and includes any technique by which the file system 120 and the storage system 140 can exchange information for disk blocks 142 and for operation of the system 100. In a preferred embodiment, the communication link 160 includes a bus coupled to the file system 120 and to the storage system 140.

[0039] The file system information tables 121 include a blockmap table 122, having a set of blockmap entries 123, indicating which disk blocks 142 are in use by allocated file system data. Thus, the blockmap table 122 indicates, for each disk block 142 on each disk 141, whether that disk block 142 is in use by the file system 120 (indicated for example by a logical “1” value) or is not in use by the file system 120 (indicated for example by a logical “0” value). As used in this description, “allocated file system data” is distinguished from any temporary data structures that might be maintained by the file system 120, which temporary data structures might possibly include on-disk components. Allocated file system data is also distinguished from backup copies of file system data that might be maintained by the file system 120, such as “snapshot” data as described in disclosures relating to the preferred “WAFL” file system 120.

[0040] The file system information tables 121 include a zeromap table 124, having a set of zeromap entries 125, indicating which disk blocks 142 have been logically or physically set to zero.

[0041] The file system information tables 121 include a stripemap table 126, having a set of stripemap entries 127, indicating which RAID stripes 143 have been migrated from a failed disk. In an aspect of the invention in which RAID stripes 143 are migrated when those RAID stripes 143 include parity information on a failed disk, each stripemap entry 127 indicates whether the data blocks 142 from that entire RAID stripe 143 have been migrated (because the parity information is not itself migrated).

[0042] Migration of Allocated Data

[0043] In the event that data in a disk block 142 is lost (for example, the disk block 142 becomes corrupted), or that all the data on a disk 141 is lost (for example, the disk fails), the storage system 140 is capable of reconstructing lost data. However, for any disk block 142 that was lost which is indicated in the blockmap table 122 to not have any allocated data, there is no need to reconstruct data for that disk block 142. Thus, for individual disk blocks 142, if lost but not in use, the storage system 140 does not have to reconstruct any data. For an entire disk 141, if lost, the storage system 140 only has to reconstruct data for those disk blocks 142 which were in use at the time.

[0044] In the event there is no spare disk, the file system 120 instructs the storage system 140 to reconstruct data for allocated disk blocks 142 (that is, disk blocks 142 indicated to be allocated by the blockmap table 122), and to copy the reconstructed data to disk blocks 142 on other non-failing disks 141 in the same RAID group in the storage system 140. In alternative embodiments, the reconstructed data may be copied onto other non-failing disks 141 in a different RAID group in the storage system 140. The disk blocks 142 for the failed disk 141 are then no longer written to, so the file system 120 treats them as “holes” in the available VBN (virtual block number) space. For example, if the failed disk is disk #3 out of disks #1, #2, #3, #4, and #5 (parity), the VBNs for disks #1, #2, and #4 will still be valid, but the VBNs for disk #3 will not. When all of the data from the failed disk 141 has been removed, the failed disk 141 is logically or physically removed from the RAID group, thus reducing the number of disks 141 in the RAID group by one.

[0045] Those skilled in the art will recognize, after perusal of this application, that use of the blockmap table 122 to reduce the amount of data reconstruction allows the storage system 140 to minimize the amount of work while maintaining the same degree of failure-tolerance. Those skilled in the art will also recognize, after perusal of this application, that this technique could be applied, without undue experimentation or new invention, to RAID and RAID-like systems that already tolerate multiple failures, such as those of Corbett or “EVENODD”. More generally, those skilled in the art will also recognize, after perusal of this application, that this technique could be applied, without undue experimentation or new invention, to all storage systems that do not have fixed places where data or metadata must be placed.

[0046] When the data for a disk block 142 on a failed disk 141 is migrated, the storage system 140 logically clears (sets to zero) the data for that disk block 142. The file system 120 sets the zeromap entry 125 for the corresponding RAID stripe 143. The storage system 140 recalculates parity for the corresponding RAID stripe 143, and writes the recalculated parity to the parity disk 141 in the corresponding RAID stripe 143.

[0047] In the event there is a spare disk, the file system 120 instructs the storage system 140 to migrate the data from allocated disk blocks 142 in like manner. For unallocated disk blocks 142, the storage system 140 writes a corresponding disk block 142 on another non-failing disk 141, but does not attempt to reconstruct data from the unallocated disk blocks 142. Rather, the storage system 140 physically clears (sets to zero) the disk block 142 that is the migration target for an unallocated disk block 142. In a preferred embodiment, the file system 120 instructs the storage system 140 to use the SCSI “write same” command to direct the disk 141 having the disk block 142 that is the migration target; this saves on activity by the disk 141 and on bandwidth between the file system 120 and the storage system 140.

[0048] The stripemap table 126 includes one stripemap entry 127 for each RAID stripe 143, indicating for that RAID stripe 143 whether the disk block 142 (from the failed disk 141) in that RAID stripe 143 has been migrated to another non-failing disk 141. When its corresponding stripemap entry 127 indicates that a particular disk block 142 has been migrated from the failing disk 141 to another non-failing disk 141, the storage system 140 is able to remove that particular disk block 142 from consideration during future parity recalculation. More precisely, the storage system 140 recalculates parity on writes to that particular stripe with the presumption that the indicated disk block 142 is uniformly zero. When the stripemap table 126 indicates that all disk blocks 142 from the failed disk 141 have been migrated to other non-failing disks 141, the file system 120 and the storage system 140 can logically delete the failed disk 141 in its entirety.

[0049] Redirection of Access Requests

[0050] The file system 120 assists the storage system 140 in redirecting requests to access disk blocks 142 on the failed disk 141. In a preferred embodiment, the file system 120 includes a copy-on-write technique in which all write operations to disk blocks 142 (on any disk 141, not just the failed disk 141) are performed by copying the data from the disk block 142 that is the target of the write operation, modifying the copy, and adjusting pointers to the target disk block 142 to point to the newly modified copy. In a preferred embodiment, these modifications are grouped together when generating a consistency point of the storage volume; however, there is no particular requirement for such grouping.

[0051] In the event of a disk 141 failure, or a data block 142 becoming corrupted, the file system 120 marks its file system information tables (including a dirty-block table having dirty-block entries) to indicate that each data block 142 that was lost is marked dirty. A first consequence is that any attempt to write the dirty data block 142 will cause a copy-on-write operation to be performed. A second consequence is that the file system 120 will generate a copy of the data block 142 as part of writing a consistency point to disk, no later than the next consistency point.

[0052] Since user requests for the lost data block 142 are redirected, and since the file system 120 will generate a copy of the data block 142 no later than the next consistency point, the storage system 140 can await instructions from the file system 120 and need not respond by aggressively reconstructing lost data blocks 142.

[0053] Proactive Zeroing of Disk Blocks

[0054] In certain cases, the file system 120 proactively instructs the storage system 140 to set an entire disk block 142 to zero, thus allowing easy recalculation (or no recalculation) of the parity information associated with the stripe containing that disk block 142. In a preferred embodiment, the file system 120 instructs the storage system 140 to use the SCSI “write same” command, as described above.

[0055] The file system 120 sets entire disk blocks to zero in at least the following cases:

[0056] When a new disk 141 is added to a RAID group, each RAID stripe 143 is thus widened by one disk block 142, and parity for each such stripe thus is responsive to data in the new disk block 142. Rather than recalculate any of the parity information, the file system 120 proactively instructs the storage system 140 to set all of the disk blocks 142 in the new disk 141 to zero, thus causing the parity information to be unchanged.

[0057] Parity is preferably calculated as the sum modulo 2, also known as the exclusive-or (“XOR”), of all data in the disk blocks 142 in the RAID stripe 143. Therefore, inserting a new disk block 142 that is all zero does not change parity in the RAID stripe 143.

[0058] When a RAID stripe that includes unallocated disk blocks 142 (that is, disk blocks 142 not marked “in use” by the file system 120) is written to, the file system 120 proactively instructs the storage system 140 to set the data in those disk blocks to zero. This allows either the file system 120 or the storage system 140, or some other component of the system 100 such as a fly-by XOR subsystem, depending on implementation, to recalculate the parity information for that stripe without having to read the unused disk block 142. Not having to read unused disk blocks 142 reduces the number of read operations performed by the storage system 140, and reduces the amount of communication bandwidth used between the file system 120 and the storage system 140.

[0059] When the file system 120 is ready to write a consistency point to disk, it generally writes a relatively large number of disk blocks 142 on the disk 141. The file system 120 attempts to group those disk blocks 142 into entire RAID stripes 143, so that write operations can be as efficient as possible, and so that parity calculation can be minimized (viewed as an overhead operation per disk block 142 of allocated data). When writing to a RAID stripe 143, the file system 120 instructs the storage system 140 to clear those disk blocks 142 in the RAID stripe that are not part of the consistency point (and are therefore going to be marked unallocated by the file system 120). This allows parity calculation to proceed without having to read those disk blocks 142.

[0060] Efficient Calculation of Parity

[0061] In an aspect of the invention, operations performed by the RAID storage system are responsive to zeromap table 125 for disk blocks 142 in a target RAID stripe 143. In response to those zeromap table 125, the file system 120 can count the number of nonzero data blocks in the target RAID stripe 143; this allows the file system 120 or the storage system 140 to determine, when writing any individual RAID stripe 143, whether it is more efficient to compute parity by subtraction or to compute parity by recalculation.

[0062] The storage system 140 can compute parity by subtraction, that is, when writing a disk block 142 to disk 141, the storage system 140 can subtract the old data in the disk block 142 from the associated parity (for that RAID stripe 143) and add the new data to be written to the disk block 142 to the associated parity. Both the subtraction and the addition are performed bitwise modulo two. Computing parity by subtraction is known in the art of RAID storage systems. Alternatively, the storage system 140 can recalculate the parity information by adding (modulo two) all of the disk blocks 142 for that RAID stripe 143.

[0063] When writing a set of disk blocks 142 to the disk 141, the file system 120 determines whether computing parity by subtraction would require fewer disk operations, or whether recalculating parity from the entire RAID stripe 143 would require fewer disk operations. The file system 120 can determine this from the zeromap table 124; it can determine if enough disk blocks in the RAID stripe are zero and can therefore be left out of calculating parity information entirely. The RAID system can also simply zero unallocated blocks in the stripe 143 if they have not been prezeroed (as indicated by the zero map). This is particularly useful for non-WAFL file systems where it is more likely that there are unallocated blocks in a stripe.

[0064] Migrating on Loss of Parity

[0065] In a RAID level 4 system, parity is maintained on a single disk 141 in the storage system 140; that is, all RAID stripes have their parity on the same disk 141, which might therefore be referred to as the “parity disk”. In a RAID level 5 system, parity is distributed across the multiple disks 141 in the storage system 140; that is, each RAID stripe might have its parity on a different disk 141, so there is no single “parity disk”.

[0066] If one disk 141 in a RAID level 5 system fails, those RAID stripes that were using the failed disk 141 for their parity no longer have a parity block, and are therefore subject to losing information if one or more of their remaining disk blocks 142 loses data. The file system 120 marks the disk blocks 142 for those RAID stripes “dirty,” so that the next time a consistency point is written to disk, those disk blocks 142 are written to different locations on the same or on other disks, in RAID stripes 143 having a valid parity block. As a result, disk blocks 142 in RAID stripes 143 whose parity has been lost are written to data blocks 142 in other RAID stripes 143 (not necessarily all to the same RAID stripes 143) that have an available parity block.

[0067] Method of Operation

[0068]FIG. 2 shows a process flow diagram of a method including using file system information in RAID data reconstruction.

[0069] A method 200 is performed by the system 100. Although the method 200 is described serially, the flow points and steps of the method 200 can be performed by separate elements in conjunction or in parallel, whether asynchronously or synchronously, in a pipelined manner, or otherwise. There is no particular requirement that the method 200 must be performed in the same order in which this description lists flow points or steps, except where explicitly so indicated.

[0070] Migration of Allocated Data

[0071] At a flow point 210, the system 100 has detected a failed disk 141.

[0072] At a step 211, the file system 120 marks the stripemap table 126 to indicate that no disk blocks 142 from any RAID stripes 143 have been migrated yet from the failed disk 141. The file system 120 also marks the dirty-block table to indicate that all disk blocks 142 on the failed disk 141 will be treated as dirty blocks. In the method 200, a first RAID stripe 143 refers to a RAID stripe on the filed disk 141. A second RAID stripe 143 refers to a RAID stripe on a spare or other non-failing disk.

[0073] At a step 212, the file system 120 receives a user request to access one of the data blocks 142 on the failed disk 141. Since user requests are only applicable to allocated data, including either file data or metadata, the method 200 proceeds at the flow point 220 to reconstruct data from the data block 142.

[0074] At a flow point 220, the method 200 is ready to reconstruct data from a data block 142 on the failed disk 141.

[0075] At a step 221, the storage system 140 determines if there is a spare disk 141. If so, the method 200 proceeds with the step 222. If not, the method 200 proceeds with the step 223.

[0076] At a step 222, (there is a spare disk 141) the storage system 140 migrates the first RAID stripe 143 associated with the disk block 142 to the spare disk 141, and the method 200 proceeds with the flow point 230. To perform this step, the storage system 140 performs the following sub-steps:

[0077] At a sub-step 222 a, the storage system 140 reconstructs data from the disk block 142. The storage system 140 uses the other data blocks 142, and the parity block, from the first RAID stripe 143. However, the storage system 140 can ignore those data blocks 142 in the first RAID stripe 143 for which the associated zeromap entry 125 indicates that the data block 142 is uniformly zero.

[0078] At a sub-step 222 b, the storage system 140 copies data from the RAID stripe 143 to a second target RAID stripe 143 on the spare disk 141. However, the storage system 140 does not copy those data blocks 142 which are unallocated, using their associated blockmap entries 123 to determine which ones. The storage system 140 proactively clears the data blocks 142 for those unallocated blockmap entries 123 in the second target RAID stripe 143, using the SCSI “write same” command. The storage system 140 recalculates parity in response to its proactive clearing of those data blocks 142.

[0079] At a sub-step 222 c, the file system 120 marks the corresponding stripemap entry 127 to indicate that the first RAID stripe 143 was entirely migrated to the spare disk 141.

[0080] At a step 223, (no spare disk 141) the storage system 140 migrates the data block 142 from the failed disk 141 to another non-failing disk 141, and the method 200 proceeds with the flow point 230. To perform this step, the storage system 140 performs the following sub-steps:

[0081] At a sub-step 223 a, the storage system 140 reconstructs data from the disk block 142. The storage system 140 uses the other data blocks 142, and the parity block, from the first RAID stripe 143. However, the storage system 140 can ignore those data blocks 142 in the first RAID stripe 143 for which the associated zeromap entry 125 indicates that the data block 142 is uniformly zero.

[0082] At a sub-step 223 b, the storage system 140 copies data into the newly allocated data block 142. The storage system 140 recalculates parity for the original first RAID stripe 143, presuming that the failed disk block 142 is now logically zero.

[0083] At a sub-step 223 c, the file system 120 marks the corresponding stripemap entry 127 for the first RAID stripe 143 associated with the data block 142 to indicate that the data block 142 was migrated to a non-failing disk 141. The file system 120 marks the corresponding zeromap entry 125 for the failed disk block 142 to indicate that the disk block 142 is now logically zero.

[0084] At a flow point 230, migration of a failed disk block 142 or an entire first RAID stripe 143 has been completed. The system 100 repeats migration until all allocated disk blocks 142 from the failed disk 141 have been migrated, either to a spare disk 141 or to other non-failing disks 141.

[0085] Mirroring Without Recalculating Parity

[0086]FIG. 3 shows a block diagram of a system capable of mirroring without recalculating parity.

[0087] As described above, when re-establishing (or initially establishing) a mirror copy of a storage volume, the target storage volume (also called the mirror storage volume) can use the computed parity from the source storage volume, by assuring that unallocated blocks on the target storage volume are set to zero when stripes including those unallocated blocks are written.

[0088] A system 300 capable of mirroring without recomputing parity includes a source system 100 including a source storage system 140, similar to the system 100 and storage system 140 described with reference to FIG. 1, and a target (or mirror) system 310 including a target storage system 320, also similar to the system 100 and storage system 140 described with reference to FIG. 1. The source storage system 140 includes a set of source RAID stripes 330 including disk blocks 331; the target storage system 320 similarly includes a set of target RAID stripes 340 including disk blocks 341. The target RAID stripes 340 are similar to, and preferably logically identical to, the source RAID stripes 330.

[0089] The source system 100 and the target system 310 are coupled using a communication link 350. In a preferred embodiment, the communication link 350 includes a fibre channel or a SAN (storage area network). In other embodiments, the communication link 350 can include a LAN (local area network), WAN (wide area network), or some combination thereof, such as an Internet connection. Those skilled in the art will recognize that the communication link 350 might include any technique for sending data from the source system 100 to the target system 310, and is not limited in any way to specific embodiments described herein.

[0090] The source RAID stripes 330 include a set of allocated blocks 331, at least one unallocated block 332, and a set of parity blocks 333.

[0091] When reestablishing (or initially establishing) a mirror relationship between the source storage system 140 and the target storage system 320, the source system 100 selects a set of allocated blocks 331 from the source RAID stripes 330 to send to the target system 310. In a preferred embodiment, these allocated blocks 331 are derived from file system information at the source system 100, and include only those data blocks indicated by a file system at the source system 100 to be allocated.

[0092] The source system 100 sends the selected allocated blocks 331, together with the parity blocks 333 associated with their RAID stripes 330, to the target system 310. Furthermore, the source system 100 zeros any unallocated blocks 332 that have not been already prezeroed. The target system 310 receives these allocated blocks 331 and stores them in its target RAID stripes 340 at corresponding locations for allocated blocks 341. Similarly, the target system 310 receives the associated parity blocks 333 and stores them in its target RAID stripes 340 at corresponding locations for parity blocks 343.

[0093] Because the target system 310 has target RAID stripes 340 that are logically identical to the source RAID stripes 330, the target system 310 can determine that all its own unallocated blocks are unallocated at the source storage system 140. The target storage system 320 can therefore set all those unallocated blocks to zero values, using the SCSI “write same” command.

[0094] As a result, the target storage system 320 will be substantially identical to the source storage system 140 after the data blocks are sent, received, and stored; hence, the mirror relationship between the source storage system 140 and the target storage system 320 is re-established.

[0095] Method of Mirroring

[0096]FIG. 4 shows a process flow diagram of a method of mirroring without recalculating parity.

[0097] A method 400 is performed by a source system 100, including a source file system 120 and source storage volume 140, and a target (mirror) system, similar to the first system 100 (not shown). Similar to the method 200, although the method 400 is described serially, the flow points and steps of the method 400 can be performed by separate elements in conjunction or in parallel, whether asynchronously or synchronously, in a pipelined manner, or otherwise. Also similar to the method 200, there is no particular requirement that the method 400 must be performed in the same order in which this description lists flow points or steps, except where explicitly so indicated.

[0098] At a flow point 410, the source system 100 and the target system are ready to reestablish a mirror relationship. In a preferred embodiment, the source system 100 and the target system have communicated so as to each arrive at a state in which the mirror relationship is about to be reestablished. Moreover, in a preferred embodiment, the source system 100 and the target system have determined a minimal set of data blocks to be sent from the source system 100 to the target system to achieve a reestablishment of the mirror. One method for determined a minimal set of data blocks is shown in the following document(s):

[0099] U.S. patent application Ser. No. 09/684,487 (Express Mail Mailing No. EL 524780596 US), filed Oct. 4, 2000, in the name of Steven R. KLEIMAN and Srinivasan VISWANATHAN, titled “Recovery of File System Data in File Servers Mirrored File System Volumes”, attorney docket 103.1031.01 (Network Appliance docket PO1-1031.01).

[0100] This document is hereby incorporated by reference as if fully set forth herein.

[0101] At a step 411, the source system 120 selects a set of information to be sent to the target system. As described above, only allocated data blocks need be sent. At this step, the selected information to be sent includes (a) striping information, and (b) parity information. Striping information describes how the data blocks that are sent are organized in RAID stripes. Parity information includes the computed parity for those RAID stripes. For information regarding which blocks in the defined RAID stripes are unallocated blocks, either the source system 120 sends that information explicitly, or the target system determines that information in response to the striping information and the identification of those data blocks it receives.

[0102] At a step 412, the source system 120 sends (and the target system receives) allocated data blocks, the striping information described in the step 411, and the parity information described in the step 411. At this step, the source system 120 can also zero unallocated blocks in the RAID stripe that have not already been prezeroed.

[0103] At a step 413, the target system writes data from the allocated data blocks into their appointed places on the designated disk drives and designated RAID stripes of its storage volume.

[0104] At a step 414, the target system writes data from the parity information into the designated RAID stripes of its storage volume.

[0105] At a step 415, the target system writes zero values to unallocated blocks in the designated RAID stripes of its storage volume. In a preferred embodiment, the target system uses the SCSI “write same” command to write copies of the same data bytes (that is, zero) to every location in each unallocated block; as described above, this is quicker than writing an actual disk block of zero values, and takes less communication bandwidth between the file system and the storage volume.

[0106] Because the unallocated blocks at the source system 120 are zero, either logically zero or physically zero, the parity information the source system 120 sends to the target system is correct when those unallocated blocks are presumed to be zero. The target system can therefore safely set those unallocated blocks to actually be zero, while using the same parity information without recomputing that parity.

[0107] At a flow point 420, the target system is a physical and logical copy of the source system 120. Any bookkeeping operations between the source system 120 and the target system are completed, and the mirror relationship between the two is reestablished.

[0108] The method 400 can be performed any time when reestablishing, or initially establishing, a mirror relationship between a source storage volume and a target storage volume, so long as equivalent RAID stripes are used at both the source storage volume and the target storage volume.

[0109] Generality of the Invention

[0110] The invention has general applicability to file systems and storage systems in which data is maintained on multiple devices, and in which at least some information recorded on those multiple devices can be discarded (for example, is not part of a file system or is a cached object that can be evicted from a cache). None of these applications are limited specifically to file systems that maintain consistency points, nor are they limited specifically to RAID storage systems, nor are they necessarily related to the specific applications disclosed herein.

[0111] Other and further applications of the invention in its most general form would be clear to those skilled in the art after perusal of this application. The invention would be usable for such other and further applications without undue experimentation or further invention. Although preferred embodiments are disclosed herein, many variations are possible which remain within the concept, scope and spirit of the invention; these variations would be clear to those skilled in the art after perusal of this application.

[0112] The invention applies to any storage system in which data and metadata are not assigned fixed locations on mass storage; this could include a file server, a database or network cache, or another type of storage device. Although in a preferred embodiment, the invention is primarily used for file servers using RAID storage systems, there is no specific requirement to limit the applicability of the invention thereto.

[0113] The invention applies to any system in which data can be reconstructed from redundant information; this could include any type of storage system, or even a communication system using at least some redundant information. Although in a preferred embodiment, the invention is primarily used for storage systems using multiple disk drives and parity, there is no specific requirement to limit the applicability of the invention thereto.

[0114] Those skilled in the art will recognize, after perusal of this application, that these alternative embodiments are illustrative and in no way limiting. 

1. A method including identifying a first group of data blocks, said first group including a block capable of maintaining redundant information associated with said data blocks; determining if there is a failed data block in said first group; in response to a result of said determining operation, reconstructing data from said failed data block and determining whether to send said data to a data block associated with a second group, said second group having at least one non-failed data block; logically setting said failed data block in said first group to a selected value, whereby later calculation of said redundant information for said first group can proceed without reconstructing said data.
 2. A method as in claim 1, including in response to information about said failed data block, determining whether to refrain from sending data from said failed data block to said second group, and instead set a target data block in said second group to said selected value.
 3. A method as in claim 1, including maintaining information about a set of said failed data blocks on a first disk, said information including whether said failed data blocks have been migrated to one or more second disks; and logically removing said first disk from a storage system when substantially all said failed data blocks have been migrated to one or more second disks.
 4. A method as in claim 1, including identifying attempts to access said failed data block; in response to said attempts to access, performing said reconstructing operation to a target data block; and redirecting said attempts to access to said target data block.
 5. A method as in claim 4, including marking said failed data block with an indicator that attempts to access said failed data block should be redirected; and performing said redirecting operation in response to said indicator.
 6. Apparatus including means for identifying a first group of data blocks, said first group including a block capable of maintaining redundant information associated with said data blocks; means for determining if there is a failed data block in said first group; means for reconstructing data from said failed data block in response to a result of said determining operation; means for sending said data to a data block associated with a second group, said second group having at least one non-failed data block; and means for logically setting said failed data block to a selected value, whereby later calculation of said redundant information for said first group can proceed without reconstructing said data.
 7. Apparatus as in claim 6, including means for, in response to information about said failed data block, possibly refraining from sending data from said failed data block to said second group, and instead setting a target data block in said second group to said selected value.
 8. Apparatus as in claim 6, including means for maintaining information about a set of said failed data blocks on a first disk, said information including whether said failed data blocks have been migrated to one or more second disks; and means for logically removing said first disk from a storage system when substantially all said failed data blocks have been migrated to one or more second disks.
 9. Apparatus as in claim 6, including means for identifying attempts to access said failed data block; in response to said attempts to access, means for performing said reconstructing operation to a target data block; and means for redirecting said attempts to access to said target data block.
 10. Apparatus as in claim 9, including means for marking said failed data block with an indicator that attempts to access said failed data block should be redirected; and means for performing said redirecting operation in response to said indicator.
 11. Memory or mass storage including instructions, said instructions being capable of being performed by one or more computing devices, said instructions directing said one or more computing devices to identify a first group of data blocks, said first group including a block capable of maintaining redundant information associated with said data blocks; determine if there is a failed data block in said first group; in response to a result of said instructions to determine, reconstruct data from said failed data block and send said data to a data block associated with a second group, said second group having at least one non-failed data block; and logically set said failed data block to a selected value, whereby later calculation of said redundant information for said first group can proceed without reconstructing said data.
 12. Memory or mass storage as in claim 11, including instructions to in response to information about said failed data block, possibly refrain from sending data from said failed data block to said second group, and instead set a target data block in said second group to said selected value.
 13. Memory or mass storage as in claim 11, including instructions to maintain information about a set of said failed data blocks on a first disk, said information including whether said failed data blocks have been migrated to one or more second disks; and logically remove said first disk from a storage system when substantially all said failed data blocks have been migrated to one or more second disks.
 14. Memory or mass storage as in claim 11, including instructions to identify attempts to access said failed data block; in response to said attempts to access, perform said instructions to reconstruct to a target data block; and redirect said attempts to access to said target data block.
 15. Memory or mass storage as in claim 14, including instructions to mark said failed data block with an indicator that attempts to access said failed data block should be redirected; and perform said instructions to redirect in response to said indicator.
 16. A method of operating a storage system, said method including setting selected disk blocks to a selected value, wherein an amount of parity recalculation by said storage system is minimized.
 17. A method as in claim 16, wherein said setting operation is responsive to a new disk added to a RAID group.
 18. A method as in claim 16, wherein said setting operation is performed when a new disk is added to a RAID group.
 19. A method as in claim 16, wherein said setting operation is performed when a consistency point is generated.
 20. A method as in claim 16, wherein said setting operation is performed when writing to a RAID stripe that has unallocated blocks.
 21. A method as in claim 16, wherein said setting operation is responsive to a write operation to disk, said write operation being associated with a RAID stripe including disk blocks that are unused by a file system.
 22. A method as in claim 16, wherein said setting operation is responsive to a file system, said file system including a consistency point at which stored data is self-consistent.
 23. A method as in claim 22, wherein said selected disk blocks include a subset of disk blocks maintained by said storage system, said subset including those disk blocks not written to as part of an operation of writing said consistency point to disk.
 24. A method as in claim 16, wherein said setting operation is responsive to a table associated with said selected disk blocks, said table including an indication that data in said selected disk blocks should be copied at a selected future time.
 25. A method as in claim 24, wherein said selected future time includes a time at which a consistency point in a file system is written to disk.
 26. A method including identifying a first group of data blocks, said first group including a block capable of maintaining redundant information associated with said data blocks; determining if said redundant information is accessible; in response to a result of said determining operation, sending data from said first group to a set of data blocks associated with one or more second groups, said second groups each having accessible blocks capable of maintaining redundant information.
 27. A method as in claim 26, wherein said step of sending data includes sending data stripes from disks that have a corresponding parity to other stripes on the same or other disks.
 28. A method as in claim 26, wherein said first group includes a RAID stripe.
 29. A method as in claim 26, wherein said determining operation includes determining if there is any failure of a disk including said block capable of maintaining said redundant information.
 30. A method as in claim 26, wherein said determining operation includes determining if there is any failure of said block capable of maintaining said redundant information.
 31. A method as in claim 26, including receiving information regarding said data blocks associated with said first group; in response to said receiving operation, performing said sending data operation only for a subset of said data blocks.
 32. A method as in claim 31, wherein said information regarding said data blocks includes at least one of: which data blocks have allocated data, which data blocks have no allocated data, which data blocks have data no longer of use.
 33. A method as in claim 31, wherein said information includes which data blocks are known to be zero.
 34. A method as in claim 26, wherein said sending operation is responsive to an indication that said data should be sent at a future time.
 35. A method as in claim 34, wherein said future time includes a time at which a file system generates a consistency point including said data from said first group.
 36. Memory or mass storage including instructions, said instructions being capable of being performed by one or more computing devices, said instructions directing said one or more computing devices to identify a first group of data blocks, said first group including a block capable of maintaining redundant information associated with said data blocks; determine if said redundant information is accessible; in response to a result of said instructions to determine, send data from said first group to a set of data blocks associated with one or more second groups, said second groups each having accessible blocks capable of maintaining redundant information.
 37. A memory or mass storage as in claim 36, wherein said instruction to sending data includes sending data stripes from disks that have a corresponding parity to other stripes on the same or other disks.
 38. Memory or mass storage as in claim 36, wherein said first group includes a RAID stripe.
 39. Memory or mass storage as in claim 36, wherein said instructions to determine include instructions to determine if there is any failure of a disk including said block capable of maintaining said redundant information.
 40. Memory or mass storage as in claim 36, wherein said instructions to determine include instructions to determine if there is any failure of said block capable of maintaining said redundant information.
 41. Memory or mass storage as in claim 36, including instructions to receive information regarding said data blocks associated with said first group; in response to said instructions to receive, perform said instructions to send only for a subset of said data blocks.
 42. Memory or mass storage as in claim 41, wherein said information regarding said data blocks includes at least one of: which data blocks have allocated data, which data blocks have no allocated data, which data blocks have data no longer of use.
 43. Memory or mass storage as in claim 41, wherein said information includes which data blocks are known to be zero.
 44. Memory or mass storage as in claim 36, wherein said instructions to send are responsive to an indication that said data should be sent at a future time.
 45. A method as in claim 44, wherein said future time includes a time at which a file system generates a consistency point including said data from said first group.
 46. A method including identifying a group of data blocks; receiving information from a file system regarding said data blocks; selecting a method of calculating, subtracting or recalculating a set of associated redundant information responsive to said data blocks, in response to a result of said information; and associating said redundant information with said data blocks in response to a result of said selecting action.
 47. A method as in claim 46, wherein said step of selecting includes selecting only data blocks which are allocated.
 48. A method as in claim 46, wherein a result of said receiving operation includes at least one of: a number of said data blocks having data allocated therefor, a number of said data blocks having data unallocated therefor, a number of said data blocks having data no longer of use to said file system.
 49. A method as in claim 46, wherein said group of data blocks are associated with a RAID group.
 50. A method as in claim 46, wherein said group of data blocks and said redundant information are associated with a RAID stripe.
 51. A method as in claim 48, wherein said method of calculating includes at least one of: computing parity by subtraction, computing parity by recalculation.
 52. A method as in claim 46, wherein a result of said receiving operation includes a number of said data blocks known to have a selected value.
 53. A method as in claim 52, wherein said selected value is zero.
 54. Apparatus including a storage system including a set of groups of data blocks, each said group of data blocks being associated with a block capable of maintaining redundant information, whereby an individual one said data block in each group can be reconstructed in response to at least some of the information in said group and at least some of said redundant information; a set of information responsive to information regarding use of said data blocks; and at least one circuit coupled to said data blocks and to said block capable of maintaining redundant information, said circuit being capable of calculating said redundant information, wherein said circuit is responsive to at least some of said information regarding use.
 55. Apparatus as in claim 54, wherein said information regarding use includes at least one of: a number of said data blocks having data allocated therefor, a number of said data blocks having data unallocated therefor, a number of said data blocks having data no longer of use to said file system.
 56. Apparatus as in claim 54, wherein said redundant information includes parity information; and said circuit is capable of at least one of: computing parity by subtraction, computing parity by recalculation.
 57. Apparatus including means for identifying a group of data blocks; means for receiving information from a file system regarding said data blocks; means for selecting a method of calculating a set of associated redundant information responsive to said data blocks, in response to a result of said determining action; and means for associating said redundant information with said data blocks in response to a result of said selecting action.
 58. An apparatus as in claim 57, wherein means for selecting includes selecting only data blocks which are allocated.
 59. Apparatus as in claim 57, wherein said information from said file system is responsive to a data structure identifying at least one of: sets of said data blocks having data allocated therefor, sets of said data blocks having data unallocated therefor, sets of said data blocks having data no longer of use to said file system.
 60. Apparatus as in claim 57, including means for calculating said redundant information in response to said means for selecting, said means for calculating including at least one of: computing parity by subtraction, computing parity by recalculation.
 61. Memory or mass storage including instructions, said instructions being capable of being performed by one or more computing devices, said instructions directing said one or more computing devices to identify a group of data blocks; receive information regarding said data blocks; select one or more of said instructions in response to said information; and associate redundant information with said group in response to a result of performing said selected instructions.
 62. Memory or mass storage as in claim 61, wherein said information regarding said data blocks includes at least one of: a number of said data blocks having allocated data, a number of said data blocks having unallocated data, a number of said data blocks having data no longer of use.
 63. Memory or mass storage as in claim 61, wherein said group of data blocks are associated with a RAID group.
 64. Memory or mass storage as in claim 61, wherein said group of data blocks and said redundant information are associated with a RAID stripe.
 65. Memory or mass storage as in claim 61, wherein said selected instructions direct said one or more computing devices to do at least one of compute parity by subtraction; compute parity by recalculation.
 66. Memory or mass storage as in claim 61, wherein said information regarding said data blocks includes a number of said data blocks known to have a selected value.
 67. A method including selecting a set of data blocks to send from a source to a target; sending said data blocks to said target; sending parity associated with said data blocks to said target; setting any unallocated blocks at said target to a selected value, whereby said parity for said data blocks is accurate; whereby a selected relationship between said source device and said target device is established.
 68. A method as in claim 67, including sending information regarding an organization of said data blocks on a storage volume.
 69. A method as in claim 67, wherein said data blocks are organized in a set of stripes, said stripes defining parity for selected groups of said data blocks; and said unallocated blocks include any blocks in said stripes not allocated for said data blocks.
 70. A method as in claim 67, wherein said set of data blocks is substantially a minimum number of data blocks not already present at said target.
 71. Memory or mass storage including instructions, said instructions being capable of being performed by one or more computing devices, said instructions directing said one or more computing devices to select a set of data blocks to send from a source to a target; send said data blocks to said target; send parity associated with said data blocks to said target; set any unallocated blocks at said target to a selected value, whereby said parity for said data blocks is accurate; whereby a selected relationship between said source device and said target device is established.
 72. Memory or mass storage as in claim 71, including instructions to send information regarding an organization of said data blocks on a storage volume.
 73. Memory or mass storage as in claim 71, wherein said data blocks are organized in a set of stripes, said stripes defining parity for selected groups of said data blocks; and said unallocated blocks include any blocks in said stripes not allocated for said data blocks.
 74. Memory or mass storage as in claim 71, wherein said set of data blocks is substantially a minimum number of data blocks not already present at said target.
 75. Apparatus including means for selecting a set of data blocks to send from a source to a target; means for sending said data blocks to said target; means for sending parity associated with said data blocks to said target; means for setting any unallocated blocks at said target to a selected value, whereby said parity for said data blocks is accurate; whereby a selected relationship between said source device and said target device is established.
 76. Apparatus as in claim 75, including means for sending information regarding an organization of said data blocks on a storage volume.
 77. Apparatus as in claim 75, wherein said data blocks are organized in a set of stripes, said stripes defining parity for selected groups of said data blocks; and said unallocated blocks include any blocks in said stripes not allocated for said data blocks.
 78. Apparatus as in claim 75, wherein said set of data blocks is substantially a minimum number of data blocks not already present at said target.
 79. An apparatus, including a zeromap table, including a set of entries describing which datablocks have been set to zero; a blockmap table, including a set of entries describing which datablocks are in use by allocated file system data; and a stripemap table, including a set of stripemap entries that correspond to one or more RAID stripes in a failed disk in a RAID group.
 80. An apparatus as in claim 79, wherein data is reconstructed from said failed disk by copying entries in said blockmap table that are associated with allocated data to a nonfailing disk in said RAID group.
 81. An apparatus as in claim 79, wherein data is reconstructed from said failed disk by copying said set of entries in said blockmap table that are associated with allocated data to a nonfailing disk in a different RAID group.
 82. An apparatus as in claim 79, wherein data is reconstructed at a next consistency point.
 83. An apparatus as in claim 79, wherein said set of entries in said stripemap table is updated after reconstructing said set of entries in said blockmap table.
 84. An apparatus as in claim 79, wherein each entry in said set of entries in said stripemap table includes a set of information relating to a migration of a RAID stripe.
 85. An apparatus as in claim 84, wherein said set of information includes a target location for said migration of disk blocks associated with said RAID stripe.
 86. An apparatus as in claim 79, wherein each entry in said set of entries in said stripemap table corresponds to information that can be deleted from said failed disk.
 87. An apparatus as in claim 79, wherein a relative difference between the number of entries in said zeromap table and the number of nonzero data blocks determines whether parity is calculated by subtraction or by adding all of the data blocks. 